package com.ea.eadp.nexus.test.workflow.pc.parentemail;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;

import com.ea.eadp.nexus.test.pageDefinition.pc.UpdateParentEmailPage;
import com.ea.eadp.nexus.test.workflow.WorkflowElement;
import com.ea.eadp.nexus.test.workflow.WorkflowElementArgument;
import org.testng.Assert;

public class InputUpdateParentEmailWorkflowElement extends WorkflowElement {
    
    protected UpdateParentEmailPage page;
    public boolean pass = true;
    public String expectedMessage = null;
    public InputUpdateParentEmailWorkflowElement(
        WebDriver driver,
        WorkflowElementArgument args
    ) {
        super(driver, args);
        page = new UpdateParentEmailPage(driver);
    }
    
    @Override
    public void init() {
        super.init();
        page.initPage();
    }
    
    @Override
    public void doAction() {
        page.txt_parentEmail.clear();
        page.txt_parentEmail.sendKeys(args.parentEmail);
    }
    
    @Override
    public void moveNext() {
        page.btn_next.click();
    }

    @Override
    public void doVerification() {
        if (!pass) {
            page.btn_next.click();

            String message = page.getStatusMessage();
            Assert.assertEquals(message, expectedMessage, "message");
        }
    }
    
}
